#!/usr/bin/env python
# -*- coding: latin-1 -*-
# -*- coding: cp1252 -*-

def summaThatta(tala):
	summa = 0
	for x in range(1, tala):
		
		if tala%x == 0:
			summa += x
	return summa

def kininTala(n):
	kininTolur = [6]
	fjoldiOddatalna = 2
	while(len(kininTolur) < n):
		summa = 0
		for x in range(1, 2*fjoldiOddatalna, 2):	#Fer yfir allar oddatölur upp að fjoldiOddatalna*2-1
			summa += x**3
		if summa == summaThatta(summa):
			kininTolur.append(summa)
		fjoldiOddatalna += 1

	return kininTolur[n-1]

print(kininTala(int(input("Kínin tala númer: "))))
